
import { ColorConfig } from "../engine/ColorConfig";
import ComponentBase from "../engine/ComponentBase";
import { Logger } from "../engine/Logger";
import ResourcesManager from "../engine/ResourceManager";
import { UI_Cache_Type, UI_Config } from "../engine/UI_Config";
import { MjWeaveItem } from "../game/model/MjWeaveItem";
import { UIHelper } from "../game/util/UIHelper";

const { ccclass, property } = cc._decorator;

@ccclass
export default class MjPrefab extends ComponentBase {


    public static Side_Type = {
        Up: 1,
        Down: 2,
        Left: 3,
        Right: 4
    }

    public static Color_Type = {
        Wan: 1,   //万
        tiao: 2, //条
        tong: 3, //同
        fan: 4 //番
    }

    public static Style_Type = {
        mo: 1,
        show: 2,
        out: 3
    }

    @property({ type: [cc.SpriteFrame] })
    public valueFameList: Array<cc.SpriteFrame> = []



    public static PREFAB_NAME: string = "MjPrefab";

    private static prefab: cc.Prefab = null;
    public static instance: MjPrefab

    private static Pool_Init_Num: number = 10;
    public prefabId: number;
    private static pool: cc.NodePool = new cc.NodePool();

    public data: number = 0x01;
    private zhishiwo: cc.Node;


    //麻将定义
    // 17,18,19, 20,21,22, 23,24,25
    // 33,34,35, 36,37,38, 39,40,41
    // 49,50,51, 52,53,54, 55,56,57
    // 65,66,67,68,  69,70,71
    //  0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,      //万子
    //  0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,      //索子
    //  0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,      //同子
    //  0x41, 0x42, 0x43, 0x44,  0x45, 0x46, 0x47,          //番子(东南西北 中发白)
    //  //0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58       //花(梅兰竹菊春夏秋冬)

    public static fan_pic_name_config: Array<string> = [
        "dong", "nan", "xi", "bei", "zhong", "fa", "bai"
    ]

    public static Mj_One_Config: Array<number> = [
        0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,      //万子
        0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,      //索子
        0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,      //同子
        0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,          //番子(东南西北 中发白)
    ]


    private downNode: cc.Node;
    private upNode: cc.Node;
    private leftNode: cc.Node;
    private rightNode: cc.Node;
    private side: number = MjPrefab.Side_Type.Down
    private style: number = MjPrefab.Style_Type.mo
    public color: number = 0
    public value: number = 0
    public isSelect: boolean = false;
    private defaultY: number;

    private static color_num_config: Array<number> = [
        9, 9, 9, 7
    ]

    private static getSpriteIndex(data: number) {
        let color: number = this.getColor(data)
        let value: number = this.getValue(data)
        let index: number = 0;
        for (let i = 0; i < this.color_num_config.length; i++) {
            if (color > i + 1) {
                index += this.color_num_config[i]
            }
        }
        index += value
        index -= 1;
        return index
    }

    public static initPool(prefab: cc.Prefab) {
        MjPrefab.prefab = prefab;
        if (this.pool.size() <= 0) {
            for (let i = 0; i < this.Pool_Init_Num; i++) {
                setTimeout(() => { //动态延迟创建
                    let tempNode: cc.Node = cc.instantiate(prefab);
                    tempNode.getComponent(MjPrefab).prefabId = i + 1;
                    if (!MjPrefab.instance) {
                        MjPrefab.instance = tempNode.getComponent(MjPrefab)
                    } else {
                        this.pool.put(tempNode);
                    }
                }, 20)
            }
        }
    }


    public static recoveryOne(mj: MjPrefab) {
        if (mj) {
            if (mj.node) {
                mj.isSelect = false
                cc.tween(mj.node).stop()
                mj.node.targetOff(mj.node);
                mj.node.stopAllActions();
                // mj.node.destroy()
                this.pool.put(mj.node);
            }
        }
    }

    public static recoveryList(mjList: Array<MjPrefab>) {
        if (mjList) {
            for (let i = 0; i < mjList.length; i++) {
                if (mjList[i]) {
                    this.recoveryOne(mjList[i]);
                }
            }
        }
    }

    // 获取值，1，2，3，4，5，6，7，8，9，a,b,c,d
    public static getValue(data: number): number {
        return data & 0x0f;
    }

    //获取花色 0,1,2,3,4
    public static getColor(data: number): number {
        return (data & 0xF0) >> 4;
    }

    public init(data: number = 0x01, style: number = MjPrefab.Style_Type.mo, side: number = MjPrefab.Side_Type.Down) {
        this.zhishiwo = this.node.getChildByName("zhishiwo")
        if (this.zhishiwo) {
            this.zhishiwo.active = false
        }
        this.isSelect = false
        this.upNode = this.findChild(this.node, "upNode")
        this.upNode.active = false
        this.downNode = this.findChild(this.node, "downNode")
        this.downNode.active = false
        this.leftNode = this.findChild(this.node, "leftNode")
        this.leftNode.active = false
        this.rightNode = this.findChild(this.node, "rightNode")
        this.rightNode.active = false


        if (isNaN(data) || data == 0) {
            data = 0x01;
        }
        this.data = data;
        this.color = MjPrefab.getColor(data)
        this.value = MjPrefab.getValue(data)

        this.side = side;
        this.style = style;

        let styleNode: cc.Node;
        if (side == MjPrefab.Side_Type.Down) {
            this.downNode.active = true
            styleNode = this.downNode
        }
        else if (side == MjPrefab.Side_Type.Up) {
            this.upNode.active = true
            styleNode = this.upNode
        }
        else if (side == MjPrefab.Side_Type.Left) {
            this.leftNode.active = true
            styleNode = this.leftNode
        }
        else if (side == MjPrefab.Side_Type.Right) {
            this.rightNode.active = true
            styleNode = this.rightNode
        }
        this.setStyle(styleNode)
    }

    public initOnlyData(data: number) {
        if (this.data != data) {
            this.init(data, this.style, this.side)
        }
    }

    public static setStyle(data: number, spriteFrameList: Array<cc.SpriteFrame>, sprite: cc.Sprite) {
        let color: number = MjPrefab.getColor(data)
        let value: number = MjPrefab.getValue(data)
        let index: number = (color - 1) * 9 + value - 1;
        // if(data == 57){
        //     Logger.log("setStyle==========", data, color, value, index)
        // }
        sprite.spriteFrame = spriteFrameList[index]
    }

    private setStyle(styleNode: cc.Node) {
        let moNode: cc.Node = styleNode.getChildByName("moNode")
        moNode.active = false
        let showNode: cc.Node = styleNode.getChildByName("showNode")
        showNode.active = false
        let outNode: cc.Node = styleNode.getChildByName("outNode")
        outNode.active = false;
        let iconValue: cc.Node;
        let spriteFrameList: Array<cc.SpriteFrame> = MjPrefab.instance.valueFameList
        if (this.style == MjPrefab.Style_Type.mo) {
            moNode.active = true
        }
        else if (this.style == MjPrefab.Style_Type.show) {
            showNode.active = true
            iconValue = showNode.getChildByName("iconValue")

        }
        else if (this.style == MjPrefab.Style_Type.out) {
            outNode.active = true
            iconValue = outNode.getChildByName("iconValue")
        }
        if (iconValue) {
            MjPrefab.setStyle(this.data, spriteFrameList, iconValue.getComponent(cc.Sprite))
        }
    }

    public static createOne(data: number = 0x01, style: number = MjPrefab.Style_Type.mo, side: number = MjPrefab.Side_Type.Down, scale: number = 1): MjPrefab {
        let node: cc.Node = null;
        if (this.pool.size() > 0) {
            node = this.pool.get();
        } else {
            node = cc.instantiate(this.prefab);
        }
        let mj: MjPrefab = node.getComponent(MjPrefab);
        mj.node.targetOff(mj.node);
        mj.node.angle = 0
        mj.node.opacity = 255;
        mj.isSelect = false
        mj.node.zIndex = 0
        mj.node.setScale(scale, scale);
        mj.init(data, style, side);
        return mj;
    }

    public select(selectOffectY: number = 50, isForce: boolean = false) {
        if (!this.isSelect) {
            this.defaultY = this.node.y;
            this.node.y += selectOffectY;
            this.isSelect = true
            Logger.log("select=", this.data)
        } else {
            this.node.y = this.defaultY;
            this.isSelect = false
        }
    }

    public unselect() {
        if (this.isSelect) {
            if (isNaN(this.defaultY)) {
                this.defaultY = this.node.y;
            }
            this.node.y = this.defaultY;
        }
        this.isSelect = false;
    }

    public showZhishi(isShow: boolean) {
        let zhishiwo: cc.Node = this.node.getChildByName("zhishiwo")
        if (zhishiwo) {
            zhishiwo.active = isShow
        }
    }

    public static initWeaveItemNode3D(zuheNode: cc.Node, mjWeaveItem: MjWeaveItem, side: number, provideSeat: number, index: number) {
        // let zas: cc.Node = zuheNode.getChildByName("zas")
        // let pengs: cc.Node = zuheNode.getChildByName("pengs")
        // let mjSpriteFrameList: Array<cc.SpriteFrame> = []
        // let path1: string = ""
        // let path2: string = ""
        // let path3: string = ""
        // let path4: string = ""
        // let path5: string = ""
        // let path6: string = ""
        // if (side == MjPrefab.Side_Type.Down) {
        //     // g011
        //     mjSpriteFrameList = MjPrefab.instance.pengDownFrameList
        //     path1 = "g" + "0" + (index + 1) + "1"
        //     path2 = "g" + "0" + (index + 1) + "2"
        //     path3 = "g" + "0" + (index + 1) + "3"
        //     path4 = "g" + "0" + (index + 1) + "4"
        //     path5 = "g" + "0" + (index + 1) + "5"
        // }
        // else if (side == MjPrefab.Side_Type.Up) {
        //     mjSpriteFrameList = MjPrefab.instance.pengUpFrameList
        //     path1 = "g" + "2" + (index + 1) + "1"
        //     path2 = "g" + "2" + (index + 1) + "2"
        //     path3 = "g" + "2" + (index + 1) + "3"
        //     path4 = "g" + "2" + (index + 1) + "4"
        //     path5 = "g" + "2" + (index + 1) + "5"
        // }
        // else if (side == MjPrefab.Side_Type.Left) {
        //     mjSpriteFrameList = MjPrefab.instance.pengRightFrameList
        //     path1 = "g" + "3" + (index + 1) + "1"
        //     path2 = "g" + "3" + (index + 1) + "2"
        //     path3 = "g" + "3" + (index + 1) + "3"
        //     path4 = "g" + "3" + (index + 1) + "4"
        //     path5 = "g" + "3" + (index + 1) + "5"
        // } else {
        //     mjSpriteFrameList = MjPrefab.instance.pengRightFrameList
        //     path1 = "g" + "1" + (index + 1) + "1"
        //     path2 = "g" + "1" + (index + 1) + "2"
        //     path3 = "g" + "1" + (index + 1) + "3"
        //     path4 = "g" + "1" + (index + 1) + "4"
        //     path5 = "g" + "1" + (index + 1) + "5"
        // }
        // path6 = path3

        // if (mjWeaveItem.weaveType == MjWeaveItem.Weave_Type.Peng ||
        //     mjWeaveItem.weaveType == MjWeaveItem.Weave_Type.Gang ||
        //     mjWeaveItem.weaveType == MjWeaveItem.Weave_Type.AnGang) {
        //     pengs.active = true
        //     zas.active = false
        //     let mj1: cc.Node = pengs.getChildByName("1")
        //     let mj2: cc.Node = pengs.getChildByName("2")
        //     let mj3: cc.Node = pengs.getChildByName("3")
        //     let mj4: cc.Node = pengs.getChildByName("4")
        //     let mj5: cc.Node = pengs.getChildByName("5")
        //     mj1.active = false
        //     mj2.active = false
        //     mj3.active = false
        //     mj4.active = false
        //     mj5.active = false
        //     let r: cc.Node = pengs.getChildByName("r")
        //     let u: cc.Node = pengs.getChildByName("u")
        //     let l: cc.Node = pengs.getChildByName("l")
        //     let d: cc.Node = pengs.getChildByName("d")
        //     if (r) {
        //         r.active = false
        //     }
        //     if (u) {
        //         u.active = false
        //     }
        //     if (l) {
        //         l.active = false
        //     }
        //     if (d) {
        //         d.active = false
        //     }
        //     if (provideSeat == 0) {
        //         if (d) {
        //             d.active = true
        //         }
        //     }
        //     else if (provideSeat == 1) {
        //         if (r) {
        //             r.active = true
        //         }
        //     }
        //     else if (provideSeat == 2) {
        //         if (u) {
        //             u.active = true
        //         }
        //     }
        //     else if (provideSeat == 3) {
        //         if (l) {
        //             l.active = true
        //         }
        //     }
        //     mj1.active = true
        //     mj2.active = true
        //     mj3.active = true
        //     MjPrefab.setStyle(mjWeaveItem.provideCard, mjSpriteFrameList, mj1.getChildByName("gm").getComponent(cc.Sprite))
        //     MjPrefab.setStyle(mjWeaveItem.provideCard, mjSpriteFrameList, mj2.getChildByName("gm").getComponent(cc.Sprite))
        //     MjPrefab.setStyle(mjWeaveItem.provideCard, mjSpriteFrameList, mj3.getChildByName("gm").getComponent(cc.Sprite))
        //     if (mjWeaveItem.weaveType == MjWeaveItem.Weave_Type.Peng) {
        //     }
        //     else if (mjWeaveItem.weaveType == MjWeaveItem.Weave_Type.Gang) {
        //         mj4.active = true
        //         MjPrefab.setStyle(mjWeaveItem.provideCard, mjSpriteFrameList, mj4.getChildByName("gm").getComponent(cc.Sprite))
        //     }
        //     else if (mjWeaveItem.weaveType == MjWeaveItem.Weave_Type.AnGang) {
        //         mj5.active = true
        //     }
        // }
        // else {
        //     pengs.active = false
        //     zas.active = true
        //     let mj1: cc.Node = zas.getChildByName("1")
        //     let mj2: cc.Node = zas.getChildByName("2")
        //     let mj3: cc.Node = zas.getChildByName("3")
        //     let mj4: cc.Node = zas.getChildByName("4")
        //     let mj5: cc.Node = zas.getChildByName("5")
        //     let mj6: cc.Node = zas.getChildByName("6")
        //     mj1.active = false
        //     mj2.active = false
        //     mj3.active = false
        //     mj4.active = false
        //     mj5.active = false
        //     mj6.active = false
        //     mj1.getChildByName("gm").active = true
        //     mj2.getChildByName("gm").active = true
        //     mj3.getChildByName("gm").active = true
        //     mj4.getChildByName("gm").active = true
        //     mj6.getChildByName("gm").active = true
        //     let r: cc.Node = zas.getChildByName("r")
        //     let u: cc.Node = zas.getChildByName("u")
        //     let l: cc.Node = zas.getChildByName("l")
        //     let d: cc.Node = zas.getChildByName("d")
        //     if (r) {
        //         r.active = false
        //     }
        //     if (u) {
        //         u.active = false
        //     }
        //     if (l) {
        //         l.active = false
        //     }
        //     if (d) {
        //         d.active = false
        //     }
        //     if (provideSeat == 0) {
        //         if (d) {
        //             d.active = true
        //         }
        //     }
        //     else if (provideSeat == 1) {
        //         if (r) {
        //             r.active = true
        //         }
        //     }
        //     else if (provideSeat == 2) {
        //         if (u) {
        //             u.active = true
        //         }
        //     }
        //     else if (provideSeat == 3) {
        //         if (l) {
        //             l.active = true
        //         }
        //     }
        //     if (mjWeaveItem.weaveType == MjWeaveItem.Weave_Type.Za
        //         || mjWeaveItem.weaveType == MjWeaveItem.Weave_Type.Zuan) {
        //         mj1.active = true
        //         mj2.active = true
        //         mj6.active = true
        //         Logger.log("Zuan====",path1, path2, path6)
        //         mj1.getComponent(cc.Sprite).spriteFrame = MjPrefab.instance.peng3dSpriteAtlas.getSpriteFrame(path1);
        //         mj2.getComponent(cc.Sprite).spriteFrame = MjPrefab.instance.peng3dSpriteAtlas.getSpriteFrame(path2);
        //         mj6.getComponent(cc.Sprite).spriteFrame = MjPrefab.instance.peng3dSpriteAtlas.getSpriteFrame(path6);

        //         MjPrefab.setStyle(mjWeaveItem.cardList[0], mjSpriteFrameList, mj1.getChildByName("gm").getComponent(cc.Sprite))
        //         MjPrefab.setStyle(mjWeaveItem.cardList[1], mjSpriteFrameList, mj2.getChildByName("gm").getComponent(cc.Sprite))
        //         MjPrefab.setStyle(mjWeaveItem.provideCard, mjSpriteFrameList, mj6.getChildByName("gm").getComponent(cc.Sprite))
        //     }
        //     else if (mjWeaveItem.weaveType == MjWeaveItem.Weave_Type.Bian) {
        //         mj1.active = true
        //         mj2.active = true
        //         mj6.active = true
        //         if (side == MjPrefab.Side_Type.Down) {
        //             mj1.getComponent(cc.Sprite).spriteFrame = MjPrefab.instance.peng3dSpriteAtlas.getSpriteFrame(path1);
        //             mj2.getComponent(cc.Sprite).spriteFrame = MjPrefab.instance.peng3dSpriteAtlas.getSpriteFrame(path2);
        //             mj6.getComponent(cc.Sprite).spriteFrame = MjPrefab.instance.peng3dSpriteAtlas.getSpriteFrame(path6);

        //             MjPrefab.setStyle(mjWeaveItem.cardList[0], mjSpriteFrameList, mj1.getChildByName("gm").getComponent(cc.Sprite))
        //             MjPrefab.setStyle(mjWeaveItem.cardList[1], mjSpriteFrameList, mj2.getChildByName("gm").getComponent(cc.Sprite))
        //             MjPrefab.setStyle(mjWeaveItem.provideCard, mjSpriteFrameList, mj6.getChildByName("gm").getComponent(cc.Sprite))
        //         } else {
        //             mj1.getChildByName("gm").active = false
        //             mj2.getChildByName("gm").active = false
        //             mj6.getChildByName("gm").active = false
        //             // MjPrefab.setStyle(mjWeaveItem.cardList[0], mjSpriteFrameList, mj1.getChildByName("gm").getComponent(cc.Sprite))
        //             if (side == MjPrefab.Side_Type.Right) {
        //                 path1 = "g" + "1" + (index + 1) + "5"
        //             }
        //             else if (side == MjPrefab.Side_Type.Up) {
        //                 path1 = "g" + "2" + (index + 1) + "5"
        //             }
        //             else if (side == MjPrefab.Side_Type.Left) {
        //                 path1 = "g" + "3" + (index + 1) + "5"
        //             }
        //             path2 = path1
        //             path6 = path1
        //             mj1.getComponent(cc.Sprite).spriteFrame = MjPrefab.instance.peng3dSpriteAtlas.getSpriteFrame(path1);
        //             mj2.getComponent(cc.Sprite).spriteFrame = MjPrefab.instance.peng3dSpriteAtlas.getSpriteFrame(path2);
        //             mj6.getComponent(cc.Sprite).spriteFrame = MjPrefab.instance.peng3dSpriteAtlas.getSpriteFrame(path6);

        //         }
        //     }
        //     else if (mjWeaveItem.weaveType == MjWeaveItem.Weave_Type.GangZa || 
        //         mjWeaveItem.weaveType == MjWeaveItem.Weave_Type.AnGangZa) {
        //         mj1.active = true;
        //         mj2.active = true
        //         mj4.active = true
        //         Logger.log("杠砸====path1====", path1)
        //         MjPrefab.setStyle(mjWeaveItem.cardList[0], mjSpriteFrameList, mj1.getChildByName("gm").getComponent(cc.Sprite))
        //         MjPrefab.setStyle(mjWeaveItem.cardList[1], mjSpriteFrameList, mj2.getChildByName("gm").getComponent(cc.Sprite))
        //         mj1.getComponent(cc.Sprite).spriteFrame = MjPrefab.instance.peng3dSpriteAtlas.getSpriteFrame(path1);
        //         mj2.getComponent(cc.Sprite).spriteFrame = MjPrefab.instance.peng3dSpriteAtlas.getSpriteFrame(path2);
        //         mj4.getComponent(cc.Sprite).spriteFrame = MjPrefab.instance.peng3dSpriteAtlas.getSpriteFrame(path4);
        //         MjPrefab.setStyle(mjWeaveItem.provideCard, mjSpriteFrameList, mj4.getChildByName("gm").getComponent(cc.Sprite))
        //         mj3.active = true
        //         mj3.getComponent(cc.Sprite).spriteFrame = MjPrefab.instance.peng3dSpriteAtlas.getSpriteFrame(path3);

        //         MjPrefab.setStyle(mjWeaveItem.provideCard, mjSpriteFrameList, mj3.getChildByName("gm").getComponent(cc.Sprite))
        //         if (mjWeaveItem.weaveType == MjWeaveItem.Weave_Type.GangZa) {
        //         } else {
        //             mj5.active = true
        //             mj4.active = false
        //             mj5.getComponent(cc.Sprite).spriteFrame = MjPrefab.instance.peng3dSpriteAtlas.getSpriteFrame(path5);
        //         }
        //     }


        // }
    }


    public static initWeaveItemNode2D(zuheNode: cc.Node, mjWeaveItem: MjWeaveItem, side: number, provideSeat: number, jiDataList: Array<number> = []) {
        let target: cc.Node = zuheNode.getChildByName("target")
        target.active = true;
        if (provideSeat == 0) {
            // if (side == MjPrefab.Side_Type.Down) {
            target.angle = 180
            // }
            // else if(side == MjPrefab.Side_Type.Right){
            //     target.angle = 180
            // }
            // else if(side == MjPrefab.Side_Type.Up){
            //     target.angle = 180
            // }
            // else if(side == MjPrefab.Side_Type.Left){
            //     target.angle = 180
            // }
        }
        else if (provideSeat == 1) {
            target.angle = 270
        }
        else if (provideSeat == 2) {
            target.angle = 0
        }
        else if (provideSeat == 3) {
            target.angle = 90
        }
        let mj0: MjPrefab = zuheNode.getChildByName("mj0").getComponent(MjPrefab)
        let mj1: MjPrefab = zuheNode.getChildByName("mj1").getComponent(MjPrefab)
        let mj2: MjPrefab = zuheNode.getChildByName("mj2").getComponent(MjPrefab)
        let mj3: MjPrefab = zuheNode.getChildByName("mj3").getComponent(MjPrefab)
        mj0.node.active = false
        mj1.node.active = false
        mj2.node.active = false
        mj3.node.active = false
        mj0.init(mjWeaveItem.cardList[0], MjPrefab.Style_Type.out, side)
        mj1.init(mjWeaveItem.cardList[1], MjPrefab.Style_Type.out, side)
        mj2.init(mjWeaveItem.cardList[2], MjPrefab.Style_Type.out, side)
        mj3.init(mjWeaveItem.cardList[0], MjPrefab.Style_Type.out, side)
        if (jiDataList.includes(mjWeaveItem.provideCard)) {
            UIHelper.setColor(mj0.node)
            UIHelper.setColor(mj1.node)
            UIHelper.setColor(mj2.node)
            UIHelper.setColor(mj3.node)
        } else {
            UIHelper.setColor(mj0.node, ColorConfig.Color_White)
            UIHelper.setColor(mj1.node, ColorConfig.Color_White)
            UIHelper.setColor(mj2.node, ColorConfig.Color_White)
            UIHelper.setColor(mj3.node, ColorConfig.Color_White)
        }

        if (mjWeaveItem.weaveType == MjWeaveItem.Weave_Type.Peng) {
            mj0.node.active = true
            mj1.node.active = true
            mj2.node.active = true
        }
        else if (mjWeaveItem.weaveType == MjWeaveItem.Weave_Type.Gang) {
            mj0.node.active = true
            mj1.node.active = true
            mj2.node.active = true
            mj3.node.active = true
        }
        else if (mjWeaveItem.weaveType == MjWeaveItem.Weave_Type.AnGang) {
            mj0.node.active = true
            mj1.node.active = true
            mj2.node.active = true
            mj3.node.active = true
            mj0.init(mjWeaveItem.cardList[0], MjPrefab.Style_Type.mo, side)
            mj1.init(mjWeaveItem.cardList[1], MjPrefab.Style_Type.mo, side)
            mj2.init(mjWeaveItem.cardList[2], MjPrefab.Style_Type.mo, side)
            // if (provideSeat == 0) {
            mj3.init(mjWeaveItem.cardList[0], MjPrefab.Style_Type.out, side)
            // } else {
            //     mj3.init(mjWeaveItem.cardList[0], MjPrefab.Style_Type.mo, side)
            // }

        }


    }


}
